home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.onyx.net!claymoor
- From: Adam.Morris@octacon.co.uk (Adam Morris)
- Newsgroups: comp.lang.ada,comp.lang.c++
- Subject: Re: on OO differnces between Ada95 and C++
- Date: Tue, 27 Feb 96 22:23:40 GMT
- Organization: Octacon Ltd
- Message-ID: <4gveoa$nnd@mulgave.octacon.co.uk>
- References: <4gbq7q$g08@qualcomm.com> <4gdidj$10f5@watnews1.watson.ibm.com>
- NNTP-Posting-Host: claymoor.onyx.net
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <4gdidj$10f5@watnews1.watson.ibm.com>,
- ncohen@watson.ibm.com (Norman H. Cohen) wrote:
- >In article <4gbq7q$g08@qualcomm.com>, nabbasi@qualcomm.com (Nasser Abbasi)
- >observes that in C and C++ one specifies an interface in a .h (or .H)
- >file and imports the interface with a #include directive, while in Ada
- >one specifies an interface with a program-unit declaration (typically a
- >package declaration) and imports it with a with clause. In C and C++
- >importing is transitive--if B #includes A and C #includes B, then C has
- >effectively #included--while in Ada it is not--if B has a with clause for
- >A and C has a with clause for B, then A is not visible in C unless C has
- >its own explicit with clause for A.
-
- Only if you do what you shouldn't do... the .h file should have forward
- declarations of all classes it uses except in certain cases. And what are
- those cases, if A inherits from B then (and only then as far as I know) should
- you #include B.h in A.h otherwise you have a declaration saying
- class B{};
-
- you #include B.h in the .cc file this means that A.cc knows about B.h but C.cc
- will only know about B.h if it has included A.h AND A is derived from B.
-
- Adam.
-